package com.cqc.googleplay.adapter;

import com.cqc.googleplay.R;
import com.cqc.googleplay.utils.CommonUtil;
import com.cqc.googleplay.utils.FragmentFactory;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class HomeFragmentAdapter extends FragmentPagerAdapter {

	private FragmentManager fm;
	private String[] titles;

	public HomeFragmentAdapter(FragmentManager fm) {
		super(fm);
		this.fm = fm;
		titles = CommonUtil.getStringArray(R.array.tab_names);
	}

	@Override
	public Fragment getItem(int position) {
		return FragmentFactory.createFragment(position);
	}

	@Override
	public int getCount() {
		return titles.length;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return titles[position];
	}
}
